home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
a3drot1a
/
3dspin.frm
next >
Wrap
Text File
|
1999-10-18
|
23KB
|
595 lines
VERSION 5.00
Begin VB.Form Form1
BackColor = &H00C0C0C0&
Caption = "Form1"
ClientHeight = 5910
ClientLeft = 2625
ClientTop = 5070
ClientWidth = 10380
FillStyle = 0 'Solid
ForeColor = &H00000000&
LinkTopic = "Form1"
ScaleHeight = 5910
ScaleWidth = 10380
Begin VB.PictureBox Pic3D
AutoRedraw = -1 'True
FillStyle = 0 'Solid
ForeColor = &H00000000&
Height = 2400
Left = 2760
ScaleHeight = 2340
ScaleWidth = 2340
TabIndex = 17
Top = 360
Width = 2400
End
Begin VB.PictureBox PicSTB
AutoRedraw = -1 'True
FillStyle = 0 'Solid
Height = 2400
Left = 7800
ScaleHeight = 2340
ScaleWidth = 2340
TabIndex = 15
Top = 3120
Width = 2400
End
Begin VB.PictureBox PicFTB
AutoRedraw = -1 'True
FillStyle = 0 'Solid
Height = 2400
Left = 7800
ScaleHeight = 2340
ScaleWidth = 2340
TabIndex = 13
Top = 360
Width = 2400
End
Begin VB.CommandButton BUTNStop
Caption = "Stop"
Height = 255
Left = 240
TabIndex = 9
Top = 1560
Width = 1935
End
Begin VB.CommandButton BUTNStart
Caption = "Start"
Height = 255
Left = 240
TabIndex = 8
Top = 1200
Width = 1935
End
Begin VB.CommandButton BUTNReset
Caption = "Reset"
Height = 255
Left = 240
TabIndex = 7
Top = 1920
Width = 1935
End
Begin VB.PictureBox PicTop
AutoRedraw = -1 'True
FillStyle = 0 'Solid
Height = 2400
Left = 5280
ScaleHeight = 2340
ScaleWidth = 2340
TabIndex = 6
Top = 3120
Width = 2400
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 50
Left = 4560
Top = 2760
End
Begin VB.CommandButton BUTNQuit
Caption = "Quit"
Height = 255
Left = 240
TabIndex = 4
Top = 2280
Width = 1935
End
Begin VB.CommandButton BUTNOKAY
Caption = "Move"
Height = 255
Left = 240
TabIndex = 3
Top = 840
Width = 1935
End
Begin VB.TextBox TEXTAngle
Height = 285
Left = 1320
TabIndex = 2
Top = 360
Width = 855
End
Begin VB.PictureBox PicFRL
AutoRedraw = -1 'True
FillStyle = 0 'Solid
Height = 2400
Left = 5280
ScaleHeight = 2340
ScaleWidth = 2340
TabIndex = 1
Top = 360
Width = 2400
End
Begin VB.PictureBox PicXY
AutoRedraw = -1 'True
FillStyle = 0 'Solid
Height = 2400
Left = 2760
ScaleHeight = 2340
ScaleWidth = 2340
TabIndex = 0
Top = 3120
Width = 2400
End
Begin VB.Label Label17
Caption = "3D rotation"
Height = 255
Left = 2760
TabIndex = 18
Top = 120
Width = 2295
End
Begin VB.Label Label16
Caption = "Side, Top to Bottom Rotation"
Height = 255
Left = 7800
TabIndex = 16
Top = 2880
Width = 2295
End
Begin VB.Label Label15
Caption = "Front, Top to Bottom Rotation"
Height = 255
Left = 7800
TabIndex = 14
Top = 120
Width = 2295
End
Begin VB.Label Label14
Caption = "Top, Right to Left Rotation"
Height = 255
Left = 5280
TabIndex = 12
Top = 2880
Width = 2295
End
Begin VB.Label Label13
Caption = "Front, Right to Left Rotation"
Height = 255
Left = 5280
TabIndex = 11
Top = 120
Width = 2295
End
Begin VB.Label Label11
Caption = "Front, Stationary"
Height = 255
Left = 2760
TabIndex = 10
Top = 2880
Width = 1575
End
Begin VB.Label Label12
Caption = "Current Angle:"
Height = 255
Left = 240
TabIndex = 5
Top = 360
Width = 1095
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Angle As Double 'The rotation angle
Dim AngleHolder As Double 'holder for previous rotation angle
Dim NumObjectSides As Integer 'Number of sides making up the object
Private Type Point 'The makeup of a point
X As Double 'the X location of the point
Y As Double 'the Y location of the point
Z As Double 'the Z location of the point
End Type
Dim Center As Point 'center of the picboxes
Private Type Verticies 'The verticies of a side
NumPoints As Integer 'The number of points on a line
Points(20) As Point 'the actual endpoints of each line
Normal As Point 'The normal of the Plane
End Type
Dim Sides(50) As Verticies 'the sides of the object
Dim XSides(50) As Verticies 'the X rotation points
Dim YSides(50) As Verticies 'the Y rotation points
Dim ZSides(50) As Verticies 'the Z rotation points
Dim Sides3D(50) As Verticies 'the 3D rotation of points
Dim CosAng(359) As Double 'A lookup table to hold the Cosine Angles
Dim SinAng(359) As Double 'A lookup table to hold the Sine Angles
Private Type POINTAPI 'This is the drawn Points of the
X As Long 'object to fill it and draw it fast
Y As Long 'using a win api function
End Type
Dim tmp() As POINTAPI
'This function is for drawing filled polygons Much faster than anything I wrote
Private Declare Function Polygon Lib "gdi32" _
(ByVal hdc As Long, lpPoint As POINTAPI, ByVal nCount As Long) As Long
Private Sub BUTNOKAY_Click()
'set the angle and draw the rotation
AngleHolder = AngleHolder + 5 'increment the angle
If AngleHolder = 360 Then 'reset the angle back to 0
AngleHolder = 0
End If
TEXTAngle.Text = AngleHolder 'display the current angle
Angle = AngleHolder 'Set the angle for calculations
Redraw 'refresh the display
End Sub
Private Sub BUTNQuit_Click()
End 'end the program
End Sub
Private Sub BUTNReset_Click()
AngleHolder = 355 'reset so displayed angle will be 0
BUTNOKAY_Click